<%@ page import="pojo.Note" %>
<%@ page import="java.util.ArrayList" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
</head>
<style>
    .title_left{
        margin-left: 420px;
    }
    .content_left{
        border:1px solid black;
        width: 440px;
        margin-left: 420px;
        height: 100px;
        margin-bottom: 20px;
    }
    .back{
        margin-left: 790px;
    }
    .pass{
        margin-left: 790px;
    }
    .page{
        margin-left: 420px;
    }
    .active{
        border:1px solid lightskyblue;
        background-color:lightskyblue;
        width:12px;
        height:10px;
    }
    .nonactive{
        border:1px solid black;
        width:12px;
        height:10px;
    }
</style>
<script>
    function passNote(id,type){
        if(confirm("您确定通过吗？")){
            location.href="${pageContext.request.contextPath}/areaPassnoteServlet?id="+id+"&type="+type;
        }
    }
</script>
<body>
<h3 align="center">待审核笔记</h3>
<a href="${pageContext.request.contextPath}/findAreaNotesPage?type=${type}" type="submit" class="back">返回</a>
<%
   String type= (String) session.getAttribute("type");
//    ImplementManager implementManager=new ImplementManager();
//    ArrayList<Note> allareanotes=new ArrayList<>();
//    allareanotes=implementManager.areaNote(type);
//    request.setAttribute("allareanotes",allareanotes);
    request.getParameter("page");
    int i=0;
    request.setAttribute("order",i);
    request.setAttribute("type",type);
%>
<c:forEach items="${page.list}" var="note" varStatus="s">
<%--    <c:if test="${note.style==0}">--%>
        <form>
            <table>
                <tr>
                    <td>
                        <h5 class="title_left" >${order=order+1}.${note.title}</h5>
                        <a href="javascript:passNote('${note.id}','${type}');" class="pass" type="submit">通过</a>
                        <p class="content_left" >${note.content}</p>
                    </td>
                </tr>
            </table>
        </form>
<%--    </c:if>--%>
</c:forEach>

<div class="page">
    <nav aria-label="page navigation">
        <ul class="pagination">
            <c:if test="${page.currentPage==1}">
    <span aria-label="Previous">
        <span aria-hidden="true">&laquo;</span>
    </span>
            </c:if>
            <c:if test="${page.currentPage!=1}">
                <a href="${pageContext.request.contextPath}/areaCheckedNotesPage?currentPage=${page.currentPage-1}&rows=5&type=${type}" aria-label="Previous">
                    <span aria-hidden="true">&laquo;</span>
                </a>
            </c:if>
            <c:forEach begin="1" end="${page.totalPage}" var="i">

                <c:if test="${page.currentPage==i}">
                    <a href="${pageContext.request.contextPath}/areaCheckedNotesPage?currentPage=${i}&rows=5&type=${type}"  class="active">${i}</a>
                </c:if>
                <c:if test="${page.currentPage!=i}">
                    <a href="${pageContext.request.contextPath}/areaCheckedNotesPage?currentPage=${i}&rows=5&type=${type}" class="nonactive">${i}</a>
                </c:if>
            </c:forEach>
            <c:if test="${page.currentPage!=page.totalPage&&page.totalPage!=0}">
                <a href="${pageContext.request.contextPath}/areaCheckedNotesPage?currentPage=${page.currentPage+1}&rows=5&type=${type}" aria-label="Next">
                    <span aria-hidden="true">&raquo;</span>
                </a>
            </c:if>
            <c:if test="${page.currentPage==page.totalPage||page.totalPage==0}">
                <span aria-label="Next">
                    <span aria-hidden="true">&raquo;</span>
                </span>
            </c:if>
            <span style="font-size: 20px;margin-left: 5px;">
                共${page.total}条笔记，共${page.totalPage}页
            </span>
        </ul>
    </nav>
</div>
</body>
</html>
